package com.frank.lzda.dygbhgjwjwfqktj.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.frank.common.annotation.Log;
import com.frank.common.enums.BusinessType;
import com.frank.lzda.dygbhgjwjwfqktj.domain.LzdaDygbhgjwjwfqktj;
import com.frank.lzda.dygbhgjwjwfqktj.service.ILzdaDygbhgjwjwfqktjService;
import com.frank.common.core.controller.BaseController;
import com.frank.common.core.domain.AjaxResult;
import com.frank.common.utils.poi.ExcelUtil;
import com.frank.common.core.page.TableDataInfo;

/**
 * 党员干部和干警违纪违法情况统计Controller
 * 
 * @author frank
 * @date 2025-08-30
 */
@Controller
@RequestMapping("/lzda/dygbhgjwjwfqktj")
public class LzdaDygbhgjwjwfqktjController extends BaseController
{
    private String prefix = "lzda/dygbhgjwjwfqktj";

    @Autowired
    private ILzdaDygbhgjwjwfqktjService lzdaDygbhgjwjwfqktjService;

    @RequiresPermissions("lzda:dygbhgjwjwfqktj:view")
    @GetMapping()
    public String dygbhgjwjwfqktj()
    {
        return prefix + "/dygbhgjwjwfqktj";
    }

    /**
     * 查询党员干部和干警违纪违法情况统计列表
     */
    @RequiresPermissions("lzda:dygbhgjwjwfqktj:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(LzdaDygbhgjwjwfqktj lzdaDygbhgjwjwfqktj)
    {
        startPage();
        List<LzdaDygbhgjwjwfqktj> list = lzdaDygbhgjwjwfqktjService.selectLzdaDygbhgjwjwfqktjList(lzdaDygbhgjwjwfqktj);
        return getDataTable(list);
    }

    /**
     * 导出党员干部和干警违纪违法情况统计列表
     */
    @RequiresPermissions("lzda:dygbhgjwjwfqktj:export")
    @Log(title = "党员干部和干警违纪违法情况统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(LzdaDygbhgjwjwfqktj lzdaDygbhgjwjwfqktj)
    {
        List<LzdaDygbhgjwjwfqktj> list = lzdaDygbhgjwjwfqktjService.selectLzdaDygbhgjwjwfqktjList(lzdaDygbhgjwjwfqktj);
        ExcelUtil<LzdaDygbhgjwjwfqktj> util = new ExcelUtil<LzdaDygbhgjwjwfqktj>(LzdaDygbhgjwjwfqktj.class);
        return util.exportExcel(list, "党员干部和干警违纪违法情况统计数据");
    }

    /**
     * 新增党员干部和干警违纪违法情况统计
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存党员干部和干警违纪违法情况统计
     */
    @RequiresPermissions("lzda:dygbhgjwjwfqktj:add")
    @Log(title = "党员干部和干警违纪违法情况统计", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(LzdaDygbhgjwjwfqktj lzdaDygbhgjwjwfqktj)
    {
        lzdaDygbhgjwjwfqktj.setCreateBy(getLoginName());
        return toAjax(lzdaDygbhgjwjwfqktjService.insertLzdaDygbhgjwjwfqktj(lzdaDygbhgjwjwfqktj));
    }

    /**
     * 修改党员干部和干警违纪违法情况统计
     */
    @RequiresPermissions("lzda:dygbhgjwjwfqktj:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        LzdaDygbhgjwjwfqktj lzdaDygbhgjwjwfqktj = lzdaDygbhgjwjwfqktjService.selectLzdaDygbhgjwjwfqktjById(id);
        mmap.put("lzdaDygbhgjwjwfqktj", lzdaDygbhgjwjwfqktj);
        return prefix + "/edit";
    }

    /**
     * 修改保存党员干部和干警违纪违法情况统计
     */
    @RequiresPermissions("lzda:dygbhgjwjwfqktj:edit")
    @Log(title = "党员干部和干警违纪违法情况统计", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(LzdaDygbhgjwjwfqktj lzdaDygbhgjwjwfqktj)
    {
        lzdaDygbhgjwjwfqktj.setUpdateBy(getLoginName());
        return toAjax(lzdaDygbhgjwjwfqktjService.updateLzdaDygbhgjwjwfqktj(lzdaDygbhgjwjwfqktj));
    }

    /**
     * 删除党员干部和干警违纪违法情况统计
     */
    @RequiresPermissions("lzda:dygbhgjwjwfqktj:remove")
    @Log(title = "党员干部和干警违纪违法情况统计", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(lzdaDygbhgjwjwfqktjService.deleteLzdaDygbhgjwjwfqktjByIds(ids));
    }
}
